package com.tester;


import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;

import com.object.Controller;
import com.object.GoToDirectionController;
import com.object.HeroPosition;
import com.object.HeroSprite;

/**
 * Classe simplesmente para testar o Sprite
 * 
 * @author Erick Zanardo
 */
public class HeroGoToControlGameTester extends BasicGame{
    private HeroSprite go;
    private long milisCount;
    private long milis;
    
    public HeroGoToControlGameTester(String title) {
        super(title);
    }

    public void init(GameContainer gameContainer) throws SlickException {
        go = new HeroSprite();
        Controller control = new GoToDirectionController(go, HeroPosition.FACE_RIGHT);
        go.setController(control);
    }

    public void update(GameContainer gameContainer, int delta) throws SlickException {
        go.updateHero(delta);
        milisCount += delta; 
        milis = milisCount / 1000;
    }

    public void render(GameContainer gameContainer, Graphics graphics) throws SlickException {
        go.drawHero();
        graphics.setColor(Color.red);
        graphics.fillRect(0, 50, 320, 20);

        graphics.setColor(Color.white);
        graphics.drawString("Time: " + milis, 400, 5);
    }

    public static void main(String[] args) throws SlickException {
        AppGameContainer app = new AppGameContainer(new HeroGoToControlGameTester("Teste"));
        app.start();
    }
}
